import logging

import grpc
import test_pb2
import test_pb2_grpc

def run():
    with grpc.insecure_channel('localhost:10086') as channel:
        client = test_pb2_grpc.UserInfoStub(channel)  # 客户端使用Stub类发送请求，参数为频道，为了绑定链接

        response = client.Info(test_pb2.request(age=0,
                                                name="张三",
                                                hobby=test_pb2.hobbies(sing=True, dance=True, rap=True, basketball=True),
                                                info={'blood_type': 'A', 'gender': 'female'},
                                                height_weight=[184, 60],
                                                opening=test_pb2.request.openings(words='music')
                                                ))

        print("用户信息："+ response.message)


if __name__ == '__main__':
    logging.basicConfig()
    run()


